|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.caucho.server.http.DummyResponse
| Constructor Summary | |
DummyResponse()
|
|
| Method Summary | |
void |
addCookie(Cookie cookie)
Adds the specified cookie to the response. |
void |
addDateHeader(java.lang.String header,
long value)
Adds a response header with the given name and date-value. |
void |
addHeader(java.lang.String header,
java.lang.String value)
Adds a response header with the given name and value. |
void |
addIntHeader(java.lang.String header,
int value)
Adds a response header with the given name and integer value. |
void |
clearBuffer()
|
void |
close()
|
boolean |
containsHeader(java.lang.String header)
Returns a boolean indicating whether the named response header has already been set. |
boolean |
disableHeaders(boolean disable)
|
java.lang.String |
encodeRedirectUrl(java.lang.String url)
|
java.lang.String |
encodeRedirectURL(java.lang.String url)
Encodes the specified URL for use in the sendRedirect method or, if encoding is not needed,
returns the URL unchanged. |
java.lang.String |
encodeUrl(java.lang.String url)
|
java.lang.String |
encodeURL(java.lang.String url)
Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged. |
void |
flushBuffer()
Forces any content in the buffer to be written to the client. |
int |
getBufferSize()
Returns the actual buffer size used for the response. |
java.lang.String |
getChain()
|
java.lang.String |
getCharacterEncoding()
Returns the name of the charset used for the MIME body sent in this response. |
boolean |
getForbidForward()
|
java.lang.String |
getHeader(java.lang.String key)
|
java.util.Locale |
getLocale()
Returns the locale assigned to the response. |
ServletOutputStream |
getOutputStream()
Returns a ServletOutputStream suitable for writing binary
data in the response. |
int |
getRemaining()
|
WriteStream |
getStream()
|
java.io.PrintWriter |
getWriter()
Returns a PrintWriter object that
can send character text to the client. |
boolean |
hasError()
|
boolean |
isCommitted()
Returns a boolean indicating if the response has been committed. |
void |
killCache()
|
void |
reset()
Clears any data that exists in the buffer as well as the status code and headers. |
void |
resetBuffer()
Clears the content of the underlying buffer in the response without clearing headers or status code. |
void |
sendError(int i)
Sends an error response to the client using the specified status code and clearing the buffer. |
void |
sendError(int i,
java.lang.String message)
Sends an error response to the client using the specified status clearing the buffer. |
void |
sendRedirect(java.lang.String location)
Sends a temporary redirect response to the client using the specified redirect location URL. |
void |
setBufferSize(int size)
Sets the preferred buffer size for the body of the response. |
void |
setContentLength(int length)
Sets the length of the content body in the response In HTTP servlets, this method sets the HTTP Content-Length header. |
void |
setContentType(java.lang.String type)
Sets the content type of the response being sent to the client. |
void |
setDateHeader(java.lang.String header,
long value)
Sets a response header with the given name and date-value. |
void |
setForbidForward(boolean forbid)
|
void |
setHasError(boolean hasError)
|
void |
setHeader(java.lang.String header,
java.lang.String value)
Sets a response header with the given name and value. |
void |
setIntHeader(java.lang.String header,
int value)
Sets a response header with the given name and integer value. |
void |
setLocale(java.util.Locale locale)
Sets the locale of the response, setting the headers (including the Content-Type's charset) as appropriate. |
void |
setSessionId(java.lang.String id)
|
void |
setStatus(int status)
Sets the status code for this response. |
void |
setStatus(int status,
java.lang.String messages)
|
void |
setStream(WriteStream os)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public DummyResponse()
| Method Detail |
public java.lang.String getCharacterEncoding()
ServletResponseIf no charset has been assigned, it is implicitly
set to ISO-8859-1 (Latin-1).
See RFC 2047 (http://ds.internic.net/rfc/rfc2045.txt) for more information about character encoding and MIME.
getCharacterEncoding in interface ServletResponsejavax.servlet.ServletResponseString specifying the
name of the charset, for
example, ISO-8859-1public void setLocale(java.util.Locale locale)
ServletResponseServletResponse.getWriter(). By default, the response locale
is the default locale for the server.setLocale in interface ServletResponsejavax.servlet.ServletResponseloc - the locale of the responseServletResponse.getLocale()public java.util.Locale getLocale()
ServletResponsegetLocale in interface ServletResponsejavax.servlet.ServletResponseServletResponse.setLocale(java.util.Locale)
public ServletOutputStream getOutputStream()
throws java.io.IOException
ServletResponseServletOutputStream suitable for writing binary
data in the response. The servlet container does not encode the
binary data.
Calling flush() on the ServletOutputStream commits the response.
Either this method or ServletResponse.getWriter() may
be called to write the body, not both.
getOutputStream in interface ServletResponsejavax.servlet.ServletResponseServletOutputStream for writing binary datajava.lang.IllegalStateException - if the getWriter method
has been called on this responsejava.io.IOException - if an input or output exception occurredServletResponse.getWriter()
public java.io.PrintWriter getWriter()
throws java.io.IOException
ServletResponsePrintWriter object that
can send character text to the client.
The character encoding used is the one specified
in the charset= property of the
ServletResponse.setContentType(java.lang.String) method, which must be called
before calling this method for the charset to take effect.
If necessary, the MIME type of the response is modified to reflect the character encoding used.
Calling flush() on the PrintWriter commits the response.
Either this method or ServletResponse.getOutputStream() may be called
to write the body, not both.
getWriter in interface ServletResponsejavax.servlet.ServletResponsePrintWriter object that
can return character data to the clientjava.io.UnsupportedEncodingException - if the charset specified in
setContentType cannot be
usedjava.lang.IllegalStateException - if the getOutputStream
method has already been called for this
response objectjava.io.IOException - if an input or output exception occurredServletResponse.getOutputStream(),
ServletResponse.setContentType(java.lang.String)public void setBufferSize(int size)
ServletResponsegetBufferSize.
A larger buffer allows more content to be written before anything is actually sent, thus providing the servlet with more time to set appropriate status codes and headers. A smaller buffer decreases server memory load and allows the client to start receiving data more quickly.
This method must be called before any response body content is
written; if content has been written, this method throws an
IllegalStateException.
setBufferSize in interface CauchoResponsejavax.servlet.ServletResponsesize - the preferred buffer sizejava.lang.IllegalStateException - if this method is called after
content has been writtenServletResponse.getBufferSize(),
ServletResponse.flushBuffer(),
ServletResponse.isCommitted(),
ServletResponse.reset()public int getBufferSize()
ServletResponsegetBufferSize in interface CauchoResponsejavax.servlet.ServletResponseServletResponse.setBufferSize(int),
ServletResponse.flushBuffer(),
ServletResponse.isCommitted(),
ServletResponse.reset()public void flushBuffer()
ServletResponseflushBuffer in interface CauchoResponsejavax.servlet.ServletResponseServletResponse.setBufferSize(int),
ServletResponse.getBufferSize(),
ServletResponse.isCommitted(),
ServletResponse.reset()public boolean isCommitted()
ServletResponseisCommitted in interface ServletResponsejavax.servlet.ServletResponseServletResponse.setBufferSize(int),
ServletResponse.getBufferSize(),
ServletResponse.flushBuffer(),
ServletResponse.reset()public void reset()
ServletResponseIllegalStateException.reset in interface CauchoResponsejavax.servlet.ServletResponsejava.lang.IllegalStateException - if the response has already been
committedServletResponse.setBufferSize(int),
ServletResponse.getBufferSize(),
ServletResponse.flushBuffer(),
ServletResponse.isCommitted()public void resetBuffer()
ServletResponseIllegalStateException.resetBuffer in interface ServletResponsejavax.servlet.ServletResponseServletResponse.setBufferSize(int),
ServletResponse.getBufferSize(),
ServletResponse.isCommitted(),
ServletResponse.reset()public void setContentLength(int length)
ServletResponsesetContentLength in interface ServletResponsejavax.servlet.ServletResponselen - an integer specifying the length of the
content being returned to the client; sets
the Content-Length headerpublic void setContentType(java.lang.String type)
ServletResponsetext/html; charset=ISO-8859-4.
If obtaining a PrintWriter, this method should be
called first.
setContentType in interface ServletResponsejavax.servlet.ServletResponsetype - a String specifying the MIME
type of the contentServletResponse.getOutputStream(),
ServletResponse.getWriter()public void setStatus(int status)
HttpServletResponsesendError method should be used
instead.
The container clears the buffer and sets the Location header, preserving cookies and other headers.
setStatus in interface HttpServletResponsejavax.servlet.http.HttpServletResponsesc - the status codeHttpServletResponse.sendError(int, java.lang.String)
public void setStatus(int status,
java.lang.String messages)
setStatus in interface HttpServletResponsejavax.servlet.http.HttpServletResponsesc - the status codesm - the status messagepublic void sendRedirect(java.lang.String location)
HttpServletResponseIf the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to.
sendRedirect in interface HttpServletResponsejavax.servlet.http.HttpServletResponselocation - the redirect location URLjava.io.IOException - If an input or output exception occursjava.lang.IllegalStateException - If the response was committedpublic void sendError(int i)
HttpServletResponseIf the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to.
sendError in interface HttpServletResponsejavax.servlet.http.HttpServletResponsesc - the error status codejava.io.IOException - If an input or output exception occursjava.lang.IllegalStateException - If the response was committed
before this method call
public void sendError(int i,
java.lang.String message)
HttpServletResponseIf the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to.
sendError in interface HttpServletResponsejavax.servlet.http.HttpServletResponsesc - the error status codemsg - the descriptive messagejava.io.IOException - If an input or output exception occursjava.lang.IllegalStateException - If the response was committedpublic java.lang.String encodeUrl(java.lang.String url)
encodeUrl in interface HttpServletResponsejavax.servlet.http.HttpServletResponseurl - the url to be encoded.public java.lang.String encodeURL(java.lang.String url)
HttpServletResponseFor robust session tracking, all URLs emitted by a servlet should be run through this method. Otherwise, URL rewriting cannot be used with browsers which do not support cookies.
encodeURL in interface HttpServletResponsejavax.servlet.http.HttpServletResponseurl - the url to be encoded.public java.lang.String encodeRedirectUrl(java.lang.String url)
encodeRedirectUrl in interface HttpServletResponsejavax.servlet.http.HttpServletResponseurl - the url to be encoded.public java.lang.String encodeRedirectURL(java.lang.String url)
HttpServletResponsesendRedirect method or, if encoding is not needed,
returns the URL unchanged. The implementation of this method
includes the logic to determine whether the session ID
needs to be encoded in the URL. Because the rules for making
this determination can differ from those used to decide whether to
encode a normal link, this method is seperate from the
encodeURL method.
All URLs sent to the HttpServletResponse.sendRedirect
method should be run through this method. Otherwise, URL
rewriting cannot be used with browsers which do not support
cookies.
encodeRedirectURL in interface HttpServletResponsejavax.servlet.http.HttpServletResponseurl - the url to be encoded.HttpServletResponse.sendRedirect(java.lang.String),
HttpServletResponse.encodeUrl(java.lang.String)public void addCookie(Cookie cookie)
HttpServletResponseaddCookie in interface HttpServletResponsejavax.servlet.http.HttpServletResponsecookie - the Cookie to return to the clientpublic boolean containsHeader(java.lang.String header)
HttpServletResponsecontainsHeader in interface HttpServletResponsejavax.servlet.http.HttpServletResponsename - the header nametrue if the named response header
has already been set;
false otherwise
public void setHeader(java.lang.String header,
java.lang.String value)
HttpServletResponsecontainsHeader method can be
used to test for the presence of a header before setting its
value.setHeader in interface HttpServletResponsejavax.servlet.http.HttpServletResponsename - the name of the headervalue - the header valueHttpServletResponse.containsHeader(java.lang.String),
HttpServletResponse.addHeader(java.lang.String, java.lang.String)
public void setIntHeader(java.lang.String header,
int value)
HttpServletResponsecontainsHeader
method can be used to test for the presence of a header before
setting its value.setIntHeader in interface HttpServletResponsejavax.servlet.http.HttpServletResponsename - the name of the headervalue - the assigned integer valueHttpServletResponse.containsHeader(java.lang.String),
HttpServletResponse.addIntHeader(java.lang.String, int)
public void setDateHeader(java.lang.String header,
long value)
HttpServletResponsecontainsHeader method can be used to test for the
presence of a header before setting its value.setDateHeader in interface HttpServletResponsejavax.servlet.http.HttpServletResponsename - the name of the header to setvalue - the assigned date valueHttpServletResponse.containsHeader(java.lang.String),
HttpServletResponse.addDateHeader(java.lang.String, long)
public void addHeader(java.lang.String header,
java.lang.String value)
HttpServletResponseaddHeader in interface CauchoResponsejavax.servlet.http.HttpServletResponsename - the name of the headervalue - the additional header valueHttpServletResponse.setHeader(java.lang.String, java.lang.String)
public void addIntHeader(java.lang.String header,
int value)
HttpServletResponseaddIntHeader in interface HttpServletResponsejavax.servlet.http.HttpServletResponsename - the name of the headervalue - the assigned integer valueHttpServletResponse.setIntHeader(java.lang.String, int)
public void addDateHeader(java.lang.String header,
long value)
HttpServletResponseaddDateHeader in interface HttpServletResponsejavax.servlet.http.HttpServletResponsename - the name of the header to setvalue - the additional date valueHttpServletResponse.setDateHeader(java.lang.String, long)
public WriteStream getStream()
throws java.io.IOException
getStream in interface CauchoResponsepublic void setStream(WriteStream os)
setStream in interface CauchoResponse
public java.lang.String getChain()
throws java.io.IOException
getChain in interface CauchoResponsepublic java.lang.String getHeader(java.lang.String key)
getHeader in interface CauchoResponsepublic void clearBuffer()
clearBuffer in interface CauchoResponse
public void close()
throws java.io.IOException
close in interface CauchoResponsepublic boolean disableHeaders(boolean disable)
disableHeaders in interface CauchoResponsepublic int getRemaining()
getRemaining in interface CauchoResponsepublic void setForbidForward(boolean forbid)
setForbidForward in interface CauchoResponsepublic boolean getForbidForward()
getForbidForward in interface CauchoResponsepublic void setHasError(boolean hasError)
setHasError in interface CauchoResponsepublic boolean hasError()
hasError in interface CauchoResponsepublic void killCache()
killCache in interface CauchoResponsepublic void setSessionId(java.lang.String id)
setSessionId in interface CauchoResponse
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||